<style xmlns="http://www.w3.org/1999/html">
    .info-wrap>td {
        text-align: left;
        padding-top: 10px;
    }
    .info-wrap>td>div {
        max-height: 200px;
        overflow-y: auto;
    }
    .tiao-val {
        width: 30px;
        height: 30px;
        margin: 5px 5px 0 0;
        outline: none;
        font-size: 14px;
    }
    .tiao-btn {
        font-size: 14px;
    }
    .link-update{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }
    .link-update:hover{
        text-decoration: none;
        color: white;
        background: #286090;
    }
    .link-del{
        text-decoration: none;
        background: red;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }
    .link-del:hover{
        text-decoration: none;
        background: red;
        color: white;
    }
    .pagination li a{
        color:#286090!important;
    }
    .pagination li.active a{
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
    }
    .tiao-val{
        width: 42px;
        height: 24px;
        text-align: center;
        line-height: 24px;
        margin: 0 10px 0 0!important;
    }
    .tiao-btn{
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
        border-radius: 3px;
    }
    .addBtn{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom:10px;
        display: inline-block;
    }
    .nav-tabs>li{
        margin-bottom: -3px!important;
    }
    .nav-tabs.nav-stacked>li>a{
        color: #0088cc;
        text-decoration: none;
    }
    .tiao-wrap{
        display: flex;
        align-items: center;
    }
    .info-wrap{
        border-bottom: 1px solid #cccccc;
    }


</style>
<link rel="stylesheet" href="https://file.viplgw.cn/ui/sat/cn/css/bootstrap.min.css">
<script src="https://file.viplgw.cn/ui/sat/cn/js/bootstrap.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/My97DatePicker/WdatePicker.js"></script>
<div class="span10">
    <div style="margin-bottom: 20px">
        <a href="/index/index">首页</a><span >&gt;</span><span>考点城市背景图</span>
    </div>

    <a class="addBtn"  href="<?php echo baseUrl.'/content/examroom/add-image'?>">添加城市背景图</a>

    <!-- <form action="<?php echo baseUrl ?>/content/examroom/image" method="get" class="form-horizontal" style="margin-bottom: 10px;">
        <table class="table">
            <tr>
                <td>
                    城市：
                </td>
                <td>
                    <select name="city" id="city" >
                        <option value ="">请选择城市</option>
                        <?php foreach($city as $v){?>
                        <option value ="<?php echo $v['city']?>" <?php echo isset($_GET['city'])&& $_GET['city']==$v['city'] ?  'selected=selected':''?>><?php echo $v['city']?></option>
                        <?php }?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <button class="btn btn-primary" type="submit">提交</button>
                </td>
            </tr>
        </table>
    </form>
 -->

    <form action="" method="post">
        <table border="0" style="table-layout: fixed;width:100%;" id="infoTable">
            <tr align="center">
                <th width="60px">id</th>
                
                <th>城市</th>
                <th>背景图片</th>
                
                <th width="120px">操作</th>
            </tr>
            <?php foreach ($data as $v) { ?>
                <tr class="info-wrap">
                    <td>
                        <div>
                            <?php echo $v['id'] ?>
                        </div>
                    </td>
                    <td>
                        <div>
                            <?php echo $v['city'] ?>
                        </div>
                    </td>
                    <td>
                        <div>
                            <?php echo $v['pic'] ?>
                        </div>
                    </td>
                    
                    <td>
                        <div>
                            <a class="link-update"
                               href="<?php echo baseUrl . '/content/examroom/add-image' . '?' . 'id=' . $v['id'] ?>">修改</a>
                            <a class="link-del" href="javascript:;" onclick="del(<?php echo $v['id'] ?>)">删除</a>
                        </div>
                    </td>
                </tr>
            <?php } ?>
        </table>
    </form>
    <div class="tiao-wrap">
        <?php echo $str?>
        <div style="margin-left: 30px;">
            <input type="text" class="tiao-val"><button class="tiao-btn">跳转</button>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tiao-btn').click(function () {
            location.href = location.pathname+"?page="+$('.tiao-val').val();
        })
    })

    function del(id){
        if(confirm("确定删除内容吗")) {
            $.get("/content/examroom/del-image", {id: id},
                function (msg) {
                    if (msg) {
                        alert('删除成功');
                        window.location.reload();
                    }
                }, 'text'
            );
        }
    }
</script>
